from typing import List

from core.domain.core_domain_entities.document import Document
from core.domain.enums import DocumentClass

from .page import AccountDocumentPage


class AccountDocument(Document):
    def __init__(
        self, expected_class: DocumentClass, pages: List[AccountDocumentPage]
    ):
        super().__init__(expected_class=expected_class, pages=pages)

    @property
    def count_pages(self) -> int:
        if self.doc_class == DocumentClass.ZOP:
            return len(self.pages)

    def update_document_pages(self, pages: List[AccountDocumentPage]):
        self.pages = pages

    def return_pages_text(self) -> List[str]:
        texts = []
        for page in self.pages:
            texts.append(page.return_page_text)

        return texts
